<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns:u="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns="http://www.w3.org/1999/xhtml">

<body>
<u:composition template="/pages/layout/pageLayout.xhtml">
	<u:define name="body">
		<h:form id="filtroForm">
			<p:panel id="panelFiltro" rendered="#{!proveedorController.addEdit}">
				<h:panelGrid columns="5">
					<h:outputText value="Nombre: " />
					<p:inputText value="#{proveedorController.proveedorQuery.nombre}">
					</p:inputText>
					<p:commandButton value="Consultar"
						actionListener="#{proveedorController.query}" update="form">
					</p:commandButton>
				</h:panelGrid>
			</p:panel>
		</h:form>

		<h:form id="form">
			<p:messages id="messages" />
			<p:dataTable id="dataTable" var="proveedor"
				value="#{proveedorController.lazyDM}" paginator="true" rows="10"
				paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="10,15,20"
				rendered="#{!proveedorController.addEdit}"
				emptyMessage="No se encontraron registros" dynamic="true">

				<f:facet name="header">
					<h:outputText value="#{msgs.admProveedor_title}" />
				</f:facet>

				<p:column>
					<f:facet name="header">
						<h:outputText value="Nombre" />
					</f:facet>
					<h:outputText value="#{proveedor.nombre}" />
				</p:column>

				<p:column>
					<f:facet name="header">
						<h:outputText value="Opciones" />
					</f:facet>
					<h:panelGrid columns="3">
						<p:commandLink actionListener="#{proveedorController.edit}"
							update="form,filtroForm">
							<h:graphicImage url="/resource/images/edit.gif" title="Modificar"
								style="border:0px" />
						</p:commandLink>
						<h:commandLink actionListener="#{proveedorController.delete}"
							onclick="return confirm('¿Está seguro de eliminar el registro?');">
							<h:graphicImage url="/resource/images/delete.gif"
								title="Eliminar" style="border:0px" />
						</h:commandLink>
					</h:panelGrid>
				</p:column>

				<f:facet name="footer">
					<p:commandButton value="Agregar"
						actionListener="#{proveedorController.add}"
						update="form,filtroForm" />
				</f:facet>
			</p:dataTable>


			<h:panelGrid id="panel" columns="1"
				rendered="#{proveedorController.addEdit}">
				<p:panel>
					<p:focus for="nombreIT" />
					<h:panelGrid columns="3">
						<h:outputText value="Nombre" />
						<p:inputText id="nombreIT"
							value="#{proveedorController.proveedorView.nombre}">
							<f:validateBean for="nombreIT" />
						</p:inputText>
						<h:message id="mnIT" for="nombreIT" />
					</h:panelGrid>
				</p:panel>

				<!-- ================================================== -->
				<!-- Opciones											-->
				<!-- ================================================== -->
				<h:panelGrid columns="2">
					<p:commandButton value="Guardar"
						actionListener="#{proveedorController.save}"
						update="form,filtroForm">
					</p:commandButton>
					<p:commandButton value="Volver"
						actionListener="#{proveedorController.cancel}" immediate="true"
						update="form,filtroForm">
					</p:commandButton>
				</h:panelGrid>
			</h:panelGrid>
		</h:form>
	</u:define>
</u:composition>
</body>
</html>